package com.y.fund.web.aavo.com;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.y.fund.utils.StrUtil;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Schema(title="登录用户信息摘要")
public class LgnUserVo {
	
	@Schema(title="此用户登录信息是否已失效；1：已失效；其他值：未失效 ")
	private Integer isExpired;

	@Schema(title="用户登录记录的ID")
	private String lgnId;

	@Schema(title="用户ID")
	private String userId;

	@Schema(title="用户编号")
	private String userCode;

	@Schema(title="用户名称")
	private String userName;

	@Schema(title="用户登录客户端类型")
	private String clientType;
	
	@Schema(title="用户当前使用角色用户分配记录ID")
	private String currRoleUserId;
	
	@Schema(title="用户当前使用角色ID")
	private String roleId;

	@Schema(title="用户当前使用角色名称")
	private String roleName;
	
	public LgnUserVo() {
		super();
	}
	
	public LgnUserVo(Integer isExpired, String lgnId, String userId, String userCode, String userName) {
		super();
		this.isExpired = isExpired;
		this.lgnId = lgnId;
		this.userId = userId;
		this.userCode = userCode;
		this.userName = userName;
	}
	
	/** 获取当前用户缓存登录信息的KEY */
	@JsonIgnore
	public static String GetCacheKey(String clientType, String userId) {
		if(StrUtil.isBlankIncNullStr(clientType)) {
			clientType = "WEB-";
		}
		if(StrUtil.isBlankIncNullStr(userId)) {
			userId = "YLgn_USER_ID";
		}
		return "Lgn-"+ clientType + "User:" + userId;
	}
	
}
